<?php

	class Apache {

		public static function getRealPath () {

			$uri = $_SERVER['SCRIPT_NAME'];

			$realPath = preg_replace ('#index\.php#','',$uri);

			return ($realPath);

		}

		public static function createRedirectHtaccess () {

			if (file_exists ('.htaccess') || !preg_match ('#index.php#',$_SERVER['SCRIPT_FILENAME']))
				return (FALSE);

			$htaccess .= 
						'RewriteEngine on'																. "\n" .
						'ReWriteBase ' . self::getRealPath()										. "\n" .
						'RewriteCond %{REQUEST_FILENAME} !-f'										. "\n" . 
						'RewriteCond %{REQUEST_FILENAME} !-d'										. "\n" .
						'RewriteRule !\.(flx|php|js|ico|txt|gif|jpg|png|css)$ index.php'	. "\n" ;

			fluxFile::write ('.htaccess',$htaccess,'w');


		}


	}

?>
